package com.pzcnet.controller;

import com.pzcnet.model.EventPublish;
import com.pzcnet.model.EventType;
import com.pzcnet.model.Payload;
import com.pzcnet.service.EventBus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by xdkxlk on 2017/8/30.
 */
@RestController
public class TestController {

    @Autowired
    private EventBus eventBus;

    @GetMapping("test")
    private String test() {
        Payload payload = new Payload();

        this.eventBus.newPublish(
                EventPublish
                        .builder()
                        .eventType(EventType.USER_DEL)
                        .payload(
                                payload.addParameter("name", "李凯")
                                        .addParameter("id", 1)
                        )
                        .build()
        );
        return "Hello";
    }
}
